var RepairTableItem = function () {
  var template = /* html */ `
    <table class="repair-table-item" cellspacing="0" cellpadding="0">
      <thead>
        <tr>
          <th style="min-width:70px">设备型号</th>
          <th style="min-width:70px">设备编号</th>
          <th style="min-width:50px">客户</th>
          <th style="min-width:60px">报修人</th>
          <th style="min-width:100px">报修人联系电话</th>
          <th style="min-width:70px">故障原因</th>
          <th style="min-width:70px">错误代码</th>
          <th style="min-width:70px">用户评价</th>
          <th style="min-width:70px">维修人员</th>
          <th style="min-width:70px">是否收费</th>
          <th style="min-width:70px">工单状态</th>
          <th style="min-width:70px">申请时间</th>
          <th style="min-width:70px">指派耗时</th>
          <th style="min-width:70px">处理耗时</th>
          <th style="min-width:70px">处理位置</th>
          <th style="min-width:70px">操作</th>
        </tr>
      </thead>
      <tbody>
        <tr v-for="(repair,index) in repairs" :key="'repair_'+index" :class="{'odd':repair.rowIndex%2!==0}">
          <td>{{repair.machineModel}}</td>
          <td>{{repair.machineSerialNo}}</td>
          <td class="is-center">{{repair.custCompany}}</td>
          <td class="is-center">{{repair.custName}}</td>
          <td>{{repair.custPhone}}</td>
          <td>{{repair.workBrokenDescription}}</td>
          <td>
            <span v-if="repair.errorCode!==''">
              {{repair.errorMsg}} ({{repair.errorCode}})
            </span>
          </td>
          <td>{{repair.custEvaluation}}</td>
          <td class="is-center">{{repair.workName}}</td>
          <td class="is-center">{{repair.custPayText}}</td>
          <td class="is-center" :class="'repair-order-status_'+repair.status">
            {{i18n.getMsg('machineRepair.repairTable.status.'+repair.status)}}
          </td>
          <td class="is-center" :title="moment(repair.createTime).format('YYYY-MM-DD HH:mm')">
            {{moment(repair.createTime).format('MM-DD HH:mm')}}
          </td>
          <td>{{repair.assignDifferTime}}</td>
          <td>{{repair.completeDifferTime}}</td>
          <td>{{repair.workCompleteLocation}}</td>
          <td class="is-center">
            <el-button size="mini" type="text" @click="lookDetail(repair)">查看详情</el-button>
          </td>
        </tr>
      </tbody>
    </table>
  `;

  return {
    props: {
      repairs: {
        type: Array,
        required: true
      }
    },

    data: function () {
      return {
        moment: moment,
        i18n: i18n
      };
    },

    methods: {
      lookDetail: function (repair) {
        this.$emit('look-detail', repair);
      }
    },

    template: template
  };
}();
